package com.lanou.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.lanou.service.OwnerUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName OwnerUserController
 * @Description: TODO
 * @Author 郅占伟
 * @Date 2023年10月24日
 * @Version: 1.0
 */
@Api(value = "业主信息",tags = "业主信息")
@RestController
public class OwnerUserController {

    @Autowired
    private OwnerUserService ownerUserService;

    @ApiOperation(value = "获取信息列表，搜索信息",httpMethod = "GET")
    @RequestMapping(value = "/getOwnerUserList", produces = "text/html;charset=UTF-8")
    public String getOwnerUserList(String pageNum, String pageSize, String userName, String idCard, String phoneNumber) throws JsonProcessingException {
        System.out.println(pageNum +" "+ pageSize);
        return ownerUserService.getOwnerList(pageNum, pageSize, userName, idCard, phoneNumber);
    }

    @ApiOperation(value = "添加用户数据,修改用户数据",httpMethod = "POST")
    @PostMapping("/addOwnerUser")
    public String handleRequest(@RequestBody Map<String, String> requestBody) {
        return ownerUserService.addModifyOwner(requestBody);
    }
}
